
public class Edge {

    int from;
    int to;

    public Edge(int from, int to) {
        this.from = from;
        this.to = to;
    }

    public Edge(String line) {
        from = Integer.parseInt(line.split(" ")[0]);
        to = Integer.parseInt(line.split(" ")[1]);
    }

    public int get(int i) {
        if (i == 0) {
            return from;
        } else {
            return to;
        }
    }

    public String toString() {
        return "(" + from + "," + to + ")";
    }
}
